package com.example.demo.config;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YKH
 * Date: 2023-01-10
 * Time: 18:10
 */

/**
 * 登录拦截器
 */
@Component
public class LoginIntercepter implements HandlerInterceptor {
//    @Override
//    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//
//        HttpSession session = request.getSession(false);
//        if(session!=null && session.getAttribute(Constant.SESSION_USERINFO_KEY)!=null){
//            //说明用户已经登录
//            return true;
//        }
//        response.setStatus(401);
//        return false;
//    }
}
